<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Collections" %><%--
  Created by IntelliJ IDEA.
  User: 12452
  Date: 2021/4/29
  Time: 15:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--
    prefix:简短名称(前缀)
    uri:引用描述文件中指定的uri
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>JSTL</title>
</head>
<body>
    <%
        List<String> list = new ArrayList<>();
        Collections.addAll(list,"hello","java","hello","world");
        pageContext.setAttribute("score","A");
        pageContext.setAttribute("list",list);
    %>
    ${list[0]}
    ${list[1]}
    ${list[2]}
    ${list[3]}
    <hr/>
    <c:if test="${score eq 'A'}">
        优秀
    </c:if><hr/>

    <c:forEach begin="0" items="${list}" var="str" step="1">
        ${str}<br/>
    </c:forEach>
</body>
</html>
